#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
using namespace std;
int main()
{
	//string st1("hello world");
	//st1.push_back(' ');
	//st1.push_back('x');
	//st1.append("yyyyyy");
	//cout << st1 << endl;
	//st1 += ' ';
	//st1 += "yzkyyds";
	//cout << st1 << endl;
	//st1.insert(0, "hello world ");
	//cout << st1 << endl;
	//st1.insert(10, "hello yzk ");
	//cout << st1 << endl;
	//st1.insert(0, "p");
	//cout << st1 << endl;
	//char ch = 'k';
	//st1.insert(0, 1, ch);
	//st1.insert(st1.begin(), ch);
	//cout << st1 << endl;
	//string st2("hello world");
	//st2.erase(6, 1);
	//cout << st2 << endl;
	//st2.erase(0, 1);
	//cout << st2 << endl;
	//st2.erase(st2.begin());
	//cout << st2 << endl;
	//st2.erase(--st2.end());
	//cout << st2 << endl;
	//st2.erase(st2.size() - 1, 1);
	//cout << st2 << endl;
	//string st3("hello world");
	//st3.erase(6);
	//cout << st3 << endl;
	//string st4("hello world");
	//st4.replace(5, 4, "%%");
	//cout << st4 << endl;
	//string st5("hello yzk hello world");
	//size_t pos = st5.find(' ');
	//while (pos != string::npos)
	//{
		//st5.replace(pos, 1, "%%");
		//pos = st5.find(' ',pos+2);
	//}
	//string tmp;
	//tmp.reserve(st5.size());
	//for (auto ch : st5)
	//{
		//if (ch == ' ')
			//tmp += "%%";
		//else
			//tmp += ch;
	//}
	//cout << tmp << endl;
	//st5 = tmp;
	//st5.swap(tmp);
	//cout << st5 << endl;
	//string file;
	//cin >> file;
	//FILE* fout = fopen(file.c_str(), "r");
	//char ch1 = fgetc(fout);
	//while (ch1 != EOF)
	//{
		//cout << ch1;
		//ch1 = fgetc(fout);
	//}
	//fclose(fout);
	//string st6("string.cpp");
	//size_t pos = st6.find('.');
	//string str = st6.substr(pos);
	//cout << str << endl;
	//string st7("string.cpp.zip");
	//size_t pos = st7.rfind('.');
	//string str2 = st7.substr(pos);
	//cout << str2 << endl;
	//string st8("yzk ");
	//string st9 = st8 + "yyds";
	//cout << st9 << endl;
	//string st10 = "yyds" + st8;
	//cout << st10 << endl;
	string st1;
	getline(cin, st1);
	size_t pos = st1.rfind(' ');
	cout << st1.size() - (pos + 1) << endl;
	return 0;
}